//
//  ScanningViewController.m
//  SpecialEffectsProject
//
//  Created by 蓓蕾 on 2021/11/4.
//

#import "ScanningViewController.h"

@interface ScanningViewController ()

@property (strong, nonatomic) UIImageView *rotatingImageView;

@end

@implementation ScanningViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIImageView *rotatingImageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
    [self.view addSubview:rotatingImageView];
    rotatingImageView.image = [UIImage imageNamed:@"组-2"];
    
    UIImageView *locationImageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 40, 20, 20)];
    [rotatingImageView addSubview:locationImageView];
    locationImageView.image = [UIImage imageNamed:@"1.2"];
    
    _rotatingImageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)];
    [self.view addSubview:_rotatingImageView];
    _rotatingImageView.image = [UIImage imageNamed:@"1.3"];
//    _rotatingImageView.backgroundColor = [UIColor orangeColor];
    
    YYWeakSelf
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        CABasicAnimation* rotationAnimation;
        rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
        rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI / 2.0 ];
        rotationAnimation.duration = .5;
        rotationAnimation.cumulative = YES;
        rotationAnimation.repeatCount = MAXFLOAT;
    
        [weakSelf.rotatingImageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
    });
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
